﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using BlobTowerDefense.Tools;

namespace BlobTowerDefense.Managers
{
    public enum PATH_INDICES { pathLevel1, pathLevel2 }

    public static class PathManager
    {
        private static Vector3[] DefaultPositions_Level1 = { new Vector3(-48.0f, -17.0f, 1.0f),
                                                             new Vector3(-45.0f, -17.0f, 1.0f),
                                                             new Vector3(-44.0f, -15.0f, 1.0f),
                                                             new Vector3(-44.0f,   8.0f, 1.0f),
                                                             new Vector3(-43.0f,   9.0f, 1.0f),
                                                             new Vector3(-31.0f,   9.0f, 1.0f),
                                                             new Vector3(-30.0f,   8.0f, 1.0f),
                                                             new Vector3(-30.0f, -15.0f, 1.0f),
                                                             new Vector3(-29.0f, -17.0f, 1.0f),
                                                             new Vector3(-17.0f, -17.0f, 1.0f),
                                                             new Vector3(-16.0f, -15.0f, 1.0f),
                                                             new Vector3(-16.0f,   8.0f, 1.0f),
                                                             new Vector3(-15.0f,   9.0f, 1.0f),
                                                             new Vector3( -3.0f,   9.0f, 1.0f),
                                                             new Vector3( -2.0f,   8.0f, 1.0f),
                                                             new Vector3( -2.0f,   3.5f, 1.0f),
                                                             new Vector3( -2.0f, -15.0f, 1.0f),
                                                             new Vector3( -1.0f, -17.0f, 1.0f),
                                                             new Vector3( 11.0f, -17.0f, 1.0f),
                                                             new Vector3( 12.0f, -15.0f, 1.0f),
                                                             new Vector3( 12.0f,   8.0f, 1.0f),
                                                             new Vector3( 13.0f,   9.0f, 1.0f),
                                                             new Vector3( 25.0f,   9.0f, 1.0f),
                                                             new Vector3( 26.0f,   8.0f, 1.0f),
                                                             new Vector3( 26.0f, -15.0f, 1.0f),
                                                             new Vector3( 27.0f, -17.0f, 1.0f),
                                                             new Vector3( 39.0f, -17.0f, 1.0f),
                                                             new Vector3( 40.0f, -15.0f, 1.0f),
                                                             new Vector3( 40.0f,   8.0f, 1.0f),
                                                             new Vector3( 41.0f,   9.0f, 1.0f),
                                                             new Vector3( 48.0f,   9.0f, 1.0f)
                                                             };
        private static float[] DefaultTimesOfPositions_Level1 =  { 0.00f,
                                                                   0.01f,
                                                                   0.02f,
                                                                   0.10f,
                                                                   0.11f,
                                                                   0.16f,
                                                                   0.17f,
                                                                   0.25f,
                                                                   0.26f,
                                                                   0.31f,
                                                                   0.32f,
                                                                   0.40f,
                                                                   0.41f,
                                                                   0.46f,
                                                                   0.48f,
                                                                   0.50f,
                                                                   0.54f,
                                                                   0.55f,
                                                                   0.60f,
                                                                   0.61f,
                                                                   0.69f,
                                                                   0.70f,
                                                                   0.75f,
                                                                   0.76f,
                                                                   0.84f,
                                                                   0.85f,
                                                                   0.90f,
                                                                   0.91f,
                                                                   0.97f,
                                                                   0.98f,
                                                                   1.0f};

        private static Vector3[] DefaultPositions_Level2 = { new Vector3(-49.0f, -21.0f, 1.0f),
                                                            new Vector3(-38.0f, -21.0f, 1.0f),
                                                            new Vector3(-38.0f, 21.5f, 1.0f),
                                                            new Vector3(-3.0f, 21.5f, 1.0f),
                                                            new Vector3(5.0f, 21.5f, 5.0f),
                                                            new Vector3(39.0f, 21.5f, 5.0f),
                                                            new Vector3(39.0f, 5f, 5.0f),
                                                            new Vector3(5.0f, 5f, 5.0f),
                                                            new Vector3(-3.0f, 5f, 1.0f),
                                                            new Vector3(-20.5f, 5f, 1.0f),
                                                            new Vector3(-20.5f, -21f, 1.0f),
                                                            new Vector3(-3f, -21f, 1.0f),
                                                            new Vector3(5f, -21f, 5.0f),
                                                            new Vector3(9f, -21f, 5.0f),
                                                            new Vector3(9f, -14f, 5.0f),
                                                            new Vector3(28f, -14f, 5.0f),
                                                            new Vector3(28f, -21f, 5.0f),
                                                            new Vector3(39f, -21f, 5.0f),
                                                            new Vector3(39f, -3f, 5.0f),
                                                            new Vector3(53f, -3f, 5.0f)
                                                            };
       private static float[] DefaultTimesOfPositions_Level2 =  { 0.000f,
                                                                  0.030f,
                                                                  0.158f,
                                                                  0.257f,
                                                                  0.287f,
                                                                  0.379f,
                                                                  0.433f,
                                                                  0.525f,
                                                                  0.555f,
                                                                  0.601f,
                                                                  0.677f,
                                                                  0.723f,
                                                                  0.753f,
                                                                  0.760f,
                                                                  0.783f,
                                                                  0.836f,
                                                                  0.859f,
                                                                  0.890f,
                                                                  0.944f,
                                                                  1.00f};

        public static Dictionary<string, Curve3D> DefaultPaths = new Dictionary<string, Curve3D>()
        {
            {"world1", new Curve3D(DefaultTimesOfPositions_Level1, DefaultPositions_Level1, 1)},
            {"world2", new Curve3D(DefaultTimesOfPositions_Level2, DefaultPositions_Level2, 2)}
        };

        /*
        public PathManager()
        {
            DefaultPositions_Level1 = new Vector3[3] { new Vector3(0.0f), 
                                                                new Vector3(0.5f),
                                                                new Vector3(1.0f, 1.0f, 0.0f) };
            DefaultTimesOfPositions_Level1 = new float[3] { 0.0f,
                                                                    0.5f,
                                                                    1.0f };
        }
        */
    }
}
